package com.example.demo.serviceImpl;

import com.example.demo.component.HandlerOrderContext;
import com.example.demo.entity.OrderDto;
import com.example.demo.service.AbstractHandler;
import com.example.demo.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 * @Copyright 上海危网信息科技有限公司版权所有
 * @company wwsoft
 * @Date 2020/4/21 10:37
 */

@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    private HandlerOrderContext handlerOrderContext;


    @Override
    public String handle(OrderDto orderDto) {
        AbstractHandler abstractHandler=handlerOrderContext.getOrderStrategy(orderDto.getType());
        return abstractHandler.handle(orderDto);
    }
}
